﻿@model QsdRenderModel
@{
    var QSDs = Model.AllSubItems;
    var pqsdid = Model.ParentID;
    var deep = Model.CurrentDeepLvl;

    var exts = (string[])TempData["FileExts"];//        var extx = new string[] { ".png", ".jpg", ".jpeg", ".gif" };
    var PreviewOnly = (bool)TempData["PreviewOnly"];    //ViewBag.ForceEdit != true && "True".Equals(Request["PreviewOnly"], StringComparison.CurrentCultureIgnoreCase);
    string parentId = "";
    if (deep > 6) { return; }
}
<ul class="qizdetails quizlv@(deep)" id="quizsd_@(pqsdid)" >
    @foreach (var QsdItem in QSDs)
    {
        //只显示用于mobile的选项 --wenke 2014/2/23
        if (!QsdItem.QizSubjectDefine.IsAllowInMobile)
        {
            continue;
        }
        try
        {
            int index = (int)TempData["QuizIndex"];
            var typeval = QsdItem.QizSubjectDefine.QizItem.TypeRef.OptionValue;
            var QsdItemId = "QSD." + QsdItem.ID;

            var IsRawTypeVal = (typeval == "7");
            var partialmodel = new QsdRenderModel()
            {
                AllSubItems = Model.AllSubItems,
                ParentID = QsdItemId,
                CurrentItem = QsdItem,
                CurrentDeepLvl = deep + 1
            };

            if (IsRawTypeVal)
            {
                parentId = String.Format("QSD_{0}", QsdItem.ID);
        @Html.Partial("QsdRenders/TypeOf_" + typeval, partialmodel);
            }
            else
            {
                var IsQsdWarrning = QsdItem.ValueAutoEvaluation == "异常";
        <li class="quiz-item-body @(QsdItem.QizSubjectDefine.QizItem.RequiredItem ? "not-null" : "") @(IsQsdWarrning ? "deviantqiz": "normalqiz")"
            data-parent="@parentId">
            <span class="quiz-idx quizlv@(deep)" style="@(IsQsdWarrning ? "color:red" : "")">
                @(QsdItem.QizSubjectDefine.QizItem.RequiredItem ? "*" : " ")@(index). </span>
            @{TempData["QuizIndex"] = ++index;}
            <span style="@(IsQsdWarrning ? "color:red;" : "color:black;")">
                @if (String.IsNullOrEmpty(QsdItem.QizSubjectDefine.ShortTitle))
                {
                    @Html.DisplayFor(model => QsdItem.QizSubjectDefine.QizItem.Title)
                }
                else
                {
                    @Html.DisplayFor(model => QsdItem.QizSubjectDefine.ShortTitle)
                }
            </span>

            <span>@Html.DisplayFor(model => QsdItem.QizSubjectDefine.QizItem.Unit)</span>
            <span>&nbsp;&nbsp;@Html.Raw(QsdItem.QizSubjectDefine.QizItem.Format)</span>
            <span><i>@QsdItem.QizSubjectDefine.QizItem.TypeRef.OptionTitle</i></span>

            @Html.Partial("QsdRenders/TypeOf_" + typeval, partialmodel)
        </li>
            }
        }
        catch (Exception ex)
        {
        <li class="error">!ERROR When process Item #@QsdItem.ID
            <span style="display: none">
                @QsdItem.UserValue
                <br />
                @ex.Message
            </span></li>
        }
    }
</ul>
